package com.open.capacity.user.feign.impl;

import com.open.capacity.common.web.Result;
import com.open.capacity.user.feign.PointsFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PointsFeignFallBack implements FallbackFactory<PointsFeign> {
    @Override
    public PointsFeign create(Throwable throwable) {
        return new PointsFeign() {
            @Override
            public Result<Integer> findPointsByUserId(long userId) {
                log.error("points-center服务异常" + throwable);
                return Result.failed("points-center服务异常");
            }

            @Override
            public Result obtain(Long userId) {
                log.error("points-center服务异常" + throwable);
                return Result.failed("points-center服务异常");
            }
        };
    }
}
